package com.kexio.enterprise.properties;

import org.springframework.boot.context.properties.ConfigurationProperties;

/**
 * Enterprise Starter 配置属性
 * 
 * @author Kexio Team
 * @since 1.0.0
 */
@ConfigurationProperties(prefix = "kexio.enterprise")
public class EnterpriseProperties {
    
    /**
     * 是否启用Enterprise Starter
     */
    private boolean enabled = true;
    
    /**
     * 可观测性配置
     */
    private Observability observability = new Observability();
    
    /**
     * 文件存储配置
     */
    private File file = new File();
    
    /**
     * 缓存配置
     */
    private Cache cache = new Cache();
    
    // Getters and Setters
    public boolean isEnabled() {
        return enabled;
    }
    
    public void setEnabled(boolean enabled) {
        this.enabled = enabled;
    }
    
    public Observability getObservability() {
        return observability;
    }
    
    public void setObservability(Observability observability) {
        this.observability = observability;
    }
    
    public File getFile() {
        return file;
    }
    
    public void setFile(File file) {
        this.file = file;
    }
    
    public Cache getCache() {
        return cache;
    }
    
    public void setCache(Cache cache) {
        this.cache = cache;
    }
    
    /**
     * 可观测性配置
     */
    public static class Observability {
        
        /**
         * 日志配置
         */
        private Logging logging = new Logging();
        
        /**
         * 指标配置
         */
        private Metrics metrics = new Metrics();
        
        // Getters and Setters
        public Logging getLogging() {
            return logging;
        }
        
        public void setLogging(Logging logging) {
            this.logging = logging;
        }
        
        public Metrics getMetrics() {
            return metrics;
        }
        
        public void setMetrics(Metrics metrics) {
            this.metrics = metrics;
        }
        
        /**
         * 日志配置
         */
        public static class Logging {
            
            /**
             * 是否启用操作日志
             */
            private boolean enabled = true;
            
            // Getters and Setters
            public boolean isEnabled() {
                return enabled;
            }
            
            public void setEnabled(boolean enabled) {
                this.enabled = enabled;
            }
        }
        
        /**
         * 指标配置
         */
        public static class Metrics {
            
            /**
             * 是否启用指标收集
             */
            private boolean enabled = true;
            
            // Getters and Setters
            public boolean isEnabled() {
                return enabled;
            }
            
            public void setEnabled(boolean enabled) {
                this.enabled = enabled;
            }
        }
    }
    
    /**
     * 文件存储配置
     */
    public static class File {
        
        /**
         * 文件存储提供者: local, minio, s3
         */
        private String provider = "local";
        
        /**
         * 上传路径
         */
        private String uploadPath = "/tmp/uploads";
        
        // Getters and Setters
        public String getProvider() {
            return provider;
        }
        
        public void setProvider(String provider) {
            this.provider = provider;
        }
        
        public String getUploadPath() {
            return uploadPath;
        }
        
        public void setUploadPath(String uploadPath) {
            this.uploadPath = uploadPath;
        }
    }
    
    /**
     * 缓存配置
     */
    public static class Cache {
        
        /**
         * 缓存同步配置
         */
        private Sync sync = new Sync();
        
        /**
         * 缓存预热配置
         */
        private Warmup warmup = new Warmup();
        
        // Getters and Setters
        public Sync getSync() {
            return sync;
        }
        
        public void setSync(Sync sync) {
            this.sync = sync;
        }
        
        public Warmup getWarmup() {
            return warmup;
        }
        
        public void setWarmup(Warmup warmup) {
            this.warmup = warmup;
        }
        
        /**
         * 缓存同步配置
         */
        public static class Sync {
            
            /**
             * 是否启用缓存同步
             */
            private boolean enabled = true;
            
            /**
             * 同步主题
             */
            private String topic = "cache.sync";
            
            // Getters and Setters
            public boolean isEnabled() {
                return enabled;
            }
            
            public void setEnabled(boolean enabled) {
                this.enabled = enabled;
            }
            
            public String getTopic() {
                return topic;
            }
            
            public void setTopic(String topic) {
                this.topic = topic;
            }
        }
        
        /**
         * 缓存预热配置
         */
        public static class Warmup {
            
            /**
             * 是否启用缓存预热
             */
            private boolean enabled = true;
            
            /**
             * 预热调度表达式
             */
            private String schedule = "0 0 2 * * ?";
            
            // Getters and Setters
            public boolean isEnabled() {
                return enabled;
            }
            
            public void setEnabled(boolean enabled) {
                this.enabled = enabled;
            }
            
            public String getSchedule() {
                return schedule;
            }
            
            public void setSchedule(String schedule) {
                this.schedule = schedule;
            }
        }
    }
}
